import Vue from "vue";
import VueRouter from "vue-router";
import HomeView from "../views/home.vue";
import Login from "@/views/login/login.vue";
import Register from "@/views/login/Register.vue";
import About from "@/views/about.vue";
import Profile from "@/views/profile";
Vue.use(VueRouter);

const routes = [
  {
    path:'',
    redirect:'/home'//路由重定向
  },
  {
    path: "/home",
    name: "home",
    component: HomeView,
  },
  {
    path: "/login",
    name: "login",
    component: Login,
  },
  {
    path: "/Register",
    name: "Register",
    component: Register,
  },
  {
    path: "/about",
    name: "about",
    component:About,
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    // component: () =>
    //   import(/* webpackChunkName: "about" */ "../views/about.vue"),
  },
  {
    path: "/profile",
    name: "profile",
    component: Profile,
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
